package com.tanhua.model.vo;

import com.tanhua.model.db.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 用户信息表
 *
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserInfoVo implements Serializable {

    private Long id;
    private String nickname; //昵称
    private String avatar; //用户头像
    private String birthday; //生日
    private String gender; //性别
    private String age; //年龄
    private String city; //城市
    private String income; //收入
    private String education; //学历
    private String profession; //行业
    private Integer marriage; //婚姻状态

    //用户状态,1为正常，2为冻结
    private String userStatus = "1";
    private Long created;


    public static UserInfoVo init(UserInfo userInfo){
        UserInfoVo vo = new UserInfoVo();
        vo.setId(userInfo.getId());
        vo.setNickname(userInfo.getNickname());
        vo.setAvatar(userInfo.getAvatar());
        vo.setCity(userInfo.getCity());
        vo.setIncome(userInfo.getIncome());
        vo.setGender(userInfo.getGender());
        vo.setAge(userInfo.getAge().toString());
        vo.setBirthday(userInfo.getBirthday());
        vo.setCreated(userInfo.getCreated().getTime());
        vo.setEducation(userInfo.getEducation());
        vo.setMarriage(userInfo.getMarriage());
        vo.setProfession(userInfo.getProfession());
        return vo;
    }
}